import React, { useState } from 'react';
function RandomList() {
  let [arr, setArr] = useState([])
  return (
    <div>
      <h1>随机数组</h1>
      <button onClick={() => {
        setArr([...arr, Math.random()])
      }}>添加随机数</button>
      <ul>
        {arr.map((val, index) => {
          return <li key={index}>{val}</li>
        })}
      </ul>

    </div>
  )
}
export default RandomList;